﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Storm;
using Storm.Plugins;
using Storm.Plugins.Attributes;
using Storm.Plugins.Classes;
using Storm.Plugins.Enums;
using Storm.Plugins.Interfaces;

namespace Plugin1
{
	[Plugin("PluginConsole", "Theodor \"Vestras\" Storm Kristensen",
	"Shows the debug messages from the PluginManager.", "1.0.0.4")]
	public partial class PluginConsole : UserControl, IPlugin
	{
		#region Fields

		private PluginManager _pluginManager = null;
		private Form _formParent             = null;
		private Icon _icon                   = null;

		private Type _type       = null;
		private string _assembly = "";
		private string _path     = "";
		private bool _enabled    = false;

		#endregion

		#region Properties

		public bool PluginEnabled
		{
			get { return _enabled; }
			set { _enabled = value; }
		}

		public PluginManager PluginManager
		{
			get { return _pluginManager; }
			set { _pluginManager = value; }
		}

		public Form FormParent
		{
			get { return _formParent; }
			set { _formParent = value; }
		}

		public Icon Icon
		{
			get { return _icon; }
			set { _icon = value; }
		}

		public string Assembly
		{
			get { return _assembly; }
			set { _assembly = value; }
		}

		public string Path
		{
			get { return _path; }
			set { _path = value; }
		}

		public Type Type
		{
			get { return _type; }
			set { _type = value; }
		}

		#endregion

		#region Methods

		#region Private

		private void OnTextAdded(object sender, EventArgs e)
		{ this.consoleText.Text = Storm.Plugins.Classes.Console.Text; }

		private void btnClear_Click(object sender, EventArgs e)
		{ this.consoleText.Text = ""; }

		#endregion

		#endregion

		/// <summary>
		/// Initializes the PluginConsole.
		/// </summary>
		public PluginConsole()
		{
			InitializeComponent();
			
			Dock = DockStyle.Bottom;
			Storm.Plugins.Classes.Console.TextAdded += OnTextAdded;
		}
	}
}
